﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


using PowerCreator.LMS.Web.Question;
using PowerCreator.LMS.Question.Entiry;
using PowerCreator.LMS.Web.Course;
using PowerCreator.LMS.Common.Script;

public partial class sysadmin_QuestionManager_EditQuestionInfo_tiank : PowerCreator.LMS.Web.Base.BasePage
{

    ManagerQuestion objQuestion = new ManagerQuestion();
    Course objCourse = new Course();
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            ViewState["TypeID"] = Request.QueryString["TypeID"].ToString();
            ViewState["QuestionID"] = Request.QueryString["qid"].ToString();
            ViewState["UserID"] = GetCreatedByInfo().UserID;
            Pageload();
            InitPage();
        }
    }

    protected override void InitPage()
    {

        lab_ContentTitle.Text = GetLanageValueByKey("lab_AddQuestionInfo_danx_ContentTitle", PowerCreator.LMS.Language.LanagetItemType.Page);
        lab_QuestionCount.Text = GetLanageValueByKey("lab_AddQuestionInfo_danx_QuestionContent", PowerCreator.LMS.Language.LanagetItemType.Page);
        

        btnSave.Text = GetLanageValueByKey("btn_Save", PowerCreator.LMS.Language.LanagetItemType.Page);
        btnBack.Text = GetLanageValueByKey("btn_Reset", PowerCreator.LMS.Language.LanagetItemType.Page);

        
        base.InitPage();
    }
    private void Pageload()
    {
        VOQuestion objQuestionInfo = new VOQuestion();
        objQuestionInfo = objQuestion.LoadQuestion(int.Parse(ViewState["QuestionID"].ToString()));
        ViewState["objQuestionInfo"] = objQuestionInfo;

        txtQuestionContent.Text = objQuestionInfo.QuestionContent;

    }
    private bool PageCheck()
    {
        return true;
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!PageCheck())
        {
            return;
        }
        VOQuestion objQuestionInfo = new VOQuestion();
        objQuestionInfo = (VOQuestion)ViewState["objQuestionInfo"];
        objQuestionInfo.FKQuestionCourseID = -1;
        objQuestionInfo.QuestionCreateID = int.Parse(ViewState["UserID"].ToString());
        //info.DateCreated = DateTime.Now;

        objQuestionInfo.QuestionAnswer = "";
        objQuestionInfo.QuestionDefaultScore = 0;
        objQuestionInfo.QuestionDiffculty =0;
        objQuestionInfo.QuestionKen ="";


        objQuestionInfo.QuestionContent = txtQuestionContent.Text;


        objQuestionInfo.QuestionState =2;         //禁用1,启用2

        objQuestion.UpdateQuetion(objQuestionInfo);//更新试题信息
        Script.RedirectURL("ManagerQuestionInfo.aspx");
    }
    protected void btnBack_Click(object sender, EventArgs e)
    {
        Script.RedirectURL("ManagerQuestionInfo.aspx");
    }
}
